<template>
	<!-- 职位列表详情信息 -->
	<view :class="pageClass" :style="pageStyle" v-if="pageReady">
		<moxi-nav :set="navSet"></moxi-nav>
		<view class="tabs" :style="{top:navHeight+'px'}">
		 <u-tabs :list="list1" @click="click" :lineColor="app_color"></u-tabs>
		 </view>
		 
		 <view class="list-box" >
			 <view class="list" @click="to(list.id)" v-for="(list,key) in data">
				 <view style="position: absolute;right: 2px;top: 10px">
					 <u-tag text="已关闭" plain size="mini" type="warning" v-if="list.status==0"></u-tag>
					  <u-tag text="开放中" plain size="mini" type="success" v-else-if="list.status==1"></u-tag>
					   <u-tag text="未通过" plain size="mini" type="danger" v-if="list.status==-2"></u-tag>
					    <u-tag text="待审核" plain size="mini" type="warning" v-if="list.status==-1"></u-tag>
				 </view>
				 <view>{{list.title}}</view>
				 <view class="bottom-text">
					 <view style="margin-right: 10px;">{{list.province}}-{{list.city}}</view> |
					 <template v-if="page_type == 'zx_zhaoping'">
						 <view style="margin: 0 10px;">{{edu[list.edu]}}</view> |
						 <view style="margin-left: 10px;">{{exp[list.exp]}}</view>
					 </template>
					 <template v-else>
						 <view style="margin: 0 10px;">期待薪资：{{list.min_money}} - {{list.max_money}}</view>
					 </template>
					 
				 </view>
				 <view style="color: red;font-size: 12px;margin-top: 15px;" v-if="list.status==-2">
					 {{list.msg}}
				 </view>
			 </view>
			 	<u-divider style="padding-bottom: 10px;" text="没有更多内容了" v-if="!data.length"></u-divider>
			 	<view style="width: 100%;height: 60px;"></view>
		 </view>
		
	
		<view class="btn" :style="{bottom:tabbar.height}">
			<view style="margin: 10px;">
				<template v-if="page_type == 'zx_zhaoping'">
					<u-button @click="fa()" text="发布新职位" :color="app_color"></u-button>
				</template>
				<template v-else>
					<u-button @click="fa()" text="发布求职信息" :color="app_color"></u-button>
				</template>
			</view>
		</view>
		<moxi-tabbar :set="tabbar" v-if="tabbar.index_id"></moxi-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
					name: '全部',
					status:"all"
					  },
					  {
						  name: '开放中',
						  status:1
					  },
					  {
						name: '已关闭',
						status:0
					  },
					  {
						name: '审核中',
						status:-1
					  },
					  {
						name: '未通过',
						status:-2
					  }
				],
				data:[],
				edu:{},
				exp:{},
				status:"all",
				page_type:"zx_qiuzhi"
			}
		},onLoad(param) {
			if(param.page_type){
				this.page_type = param.page_type;
			}
			this.get()
		},
		methods: {
			to(id){
				if(this.page_type == 'zx_qiuzhi'){
					this.navto('pages/plugin/zx/jobcontent?id='+id)
				}else{
					this.navto('pages/plugin/zx/jobDetails?id='+id)
				}
			},
			click(e){
				this.status = e.status;
				this.get()
			},
			get(){
				this.moxiPost('/plugin/zx/user/zhaoping/get',{status:this.status,page_type:this.page_type},(data)=>{
					this.edu = data.edu;
					this.exp = data.exp;
					this.data = data.data;
					console.log(this.data);
				})
			},
			  fa(){
				  if(this.page_type=='zx_zhaoping'){
					  uni.redirectTo({
					  	url: '/pages/plugin/zx/addJob'
					  });
				  }else{
					  uni.redirectTo({
					  	url: '/pages/plugin/zx/jobhunt'
					  });
				  }
			  }
		}
	}
</script>

<style>
	.bottom-text{display: flex;flex-direction: row;font-size: 12px;color: #666;margin-top: 15px;}
.list-box{display: flex;flex-direction: column;margin: 10px;;}
.list{display: flex;flex-direction: column;padding: 10px;margin: 10px 0;
border-radius: 5px;border-bottom:1px #eee solid;position: relative;}
.btn{position: fixed;left: 0;bottom: 0;width: 100%;background: #fff;}
.tabs{background: #fff;box-shadow: 1px 6px 6px #ccc;position: sticky;top:0;z-index: 2;}
</style>
